<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="zh" xml:lang="zh"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
<ui:composition template="templates/common.xhtml">
    <ui:define name="pageTitle">#{labels.appName}</ui:define>
    <ui:define name="mainContents">
        <div class="row">
            <div class="large-10 large-centered columns">
                <nav class="breadcrumbs">
                    <h:outputLink value="index.html">#{labels.commonMenuGlance}</h:outputLink>
                    <h:outputLink value="#{'#'}" styleClass="unavailable">#{labels.commonMenuVenue}</h:outputLink>
                    <h:outputLink value="#{'#'}"
                                  styleClass="current">#{labels.commonMenuChargeSchemeManage}</h:outputLink>
                </nav>
            </div>
        </div>
        <div class="row standard-gap-top">
            <h:form id="charge_scheme_man">
                <div class="large-9 large-centered columns">
                    <div class="row">
                        <div class="small-2 columns">
                            <h:outputLabel for="schemeselect" value="#{labels.chschManageSchemeSelect}"
                                           styleClass="inline"/>
                        </div>
                        <div class="small-6 columns end">
                            <h:selectOneMenu id="schemeselect" value="#{chargeSchemeFormBean.selectedScheme}"
                                             valueChangeListener="#{chargeSchemeSelectBean.loadSchemeDetail}">
                                <f:selectItem itemLabel="#{labels.formAddContent}" itemValue="new_content"/>
                                <f:selectItems value="#{chargeSchemesBean.schemes}" var="scheme"
                                               itemLabel="#{scheme.name}" itemValue="#{scheme.schemeId}"/>
                                <f:ajax render="@form"/>
                            </h:selectOneMenu>
                        </div>
                    </div>
                    <div class="row">
                        <h:inputHidden id="schemeAddMode" value="#{chargeSchemeFormBean.addMode}"/>

                        <div class="small-6 columns">
                            <h:inputText id="schemename" p:placeholder="#{labels.chschManageSchemeName}"
                                         value="#{chargeSchemeFormBean.schemeName}"/>
                        </div>
                        <div class="small-3 columns">
                            <ul class="button-group even-2">
                                <li>
                                    <h:commandButton value="#{labels.formSave}" styleClass="button small"
                                                     action="#{chargeSchemeBean.saveScheme}">
                                        <f:ajax execute="@form" render="@form"/>
                                    </h:commandButton>
                                </li>
                                <li>
                                    <h:commandButton value="#{labels.formRemove}" styleClass="button small alert"
                                                     action="#{chargeSchemeBean.removeScheme}"
                                                     onclick="return confirm('#{labels.chschManageSchemeConfirmDelete}');">
                                        <f:ajax render="@form"/>
                                    </h:commandButton>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="row">
                        <div class="small-4 columns">
                            <h:outputLabel value="#{labels.chschManageSchemeDisbaled}" for="schemedisabled"/>
                            <h:selectOneMenu id="schemedisabled" value="#{chargeSchemeFormBean.enableScheme}">
                                <f:selectItem itemLabel="#{labels.formEnabled}" itemValue="true"/>
                                <f:selectItem itemLabel="#{labels.formDisabled}" itemValue="false"/>
                            </h:selectOneMenu>
                        </div>
                        <div class="small-4 columns">
                            <h:outputLabel value="#{labels.chschManageSchemeExtendRuleTime}"
                                           for="extendrule"/>
                            <h:selectOneMenu id="extendrule" value="#{chargeSchemeFormBean.extendTime}">
                                <f:selectItem itemLabel="#{labels.formEnabled}" itemValue="true"/>
                                <f:selectItem itemLabel="#{labels.formDisabled}" itemValue="false"/>
                            </h:selectOneMenu>
                        </div>
                        <div class="small-4 columns">
                            <h:outputLabel value="#{labels.chschManageSchemePreciseCharge}"
                                           for="precisecharge"/>
                            <h:selectOneMenu id="precisecharge" value="#{chargeSchemeFormBean.preciseCharge}">
                                <f:selectItem itemLabel="#{labels.formEnabled}" itemValue="true"/>
                                <f:selectItem itemLabel="#{labels.formDisabled}" itemValue="false"/>
                            </h:selectOneMenu>
                        </div>
                    </div>
                    <div class="row">
                        <div class="small-12 columns">
                            <ul class="explains">
                                <li>
                                    <em>#{labels.chschManageSchemeExtendRuleTime}</em><span>#{labels.chschManageSchemeExtendRuleTimeTooltip}</span>
                                </li>
                                <li>
                                    <em>#{labels.chschManageSchemePreciseCharge}</em><span>#{labels.chschManageSchemePreciseChargeTooltip}</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="row">
                        <div class="small-6 columns">
                            <fieldset>
                                <legend>#{labels.chschManageSchemeRules}</legend>
                                <div class="row collapse">
                                    <div class="small-9 columns">
                                        <h:inputText id="rulekeyword" value="#{chargeRuleFormBean.searchKeyword}"
                                                     p:placeholder="#{labels.chschManageSchemeRulesKeyword}"/>
                                    </div>
                                    <div class="small-3 columns">
                                        <h:commandButton value="#{labels.formSearch}" styleClass="button postfix"
                                                         action="#{chargeRuleBean.searchRules}">
                                            <f:ajax execute="schemeselect rulekeyword" render="@form"/>
                                        </h:commandButton>
                                    </div>
                                </div>
                                <h:selectOneListbox id="ruleselect" size="12" style="background: none; height: 100%;"
                                                    value="#{chargeRuleFormBean.selectedRule}"
                                                    valueChangeListener="#{chargeRuleSelectBean.loadRuleDetail}">
                                    <f:selectItem itemLabel="#{labels.formAddContent}" itemValue="new_content"/>
                                    <f:selectItems value="#{chargeRulesBean.rules}" var="rule"
                                                   itemLabel="#{rule.name}" itemValue="#{rule.ruleId}"/>
                                    <f:ajax execute="schemeselect ruleselect" render="@form"/>
                                </h:selectOneListbox>
                            </fieldset>
                        </div>
                        <div class="small-6 columns">
                            <h:inputHidden id="ruleAddMode" value="#{chargeRuleFormBean.addMode}"/>
                            <fieldset>
                                <legend>#{chargeRuleFormBean.addMode?labels.chschManageSchemeRuleAdd:labels.chschManageSchemeRuleModify}</legend>
                                <div class="row">
                                    <div class="small-12 columns">
                                        <h:outputLabel for="rulename" value="#{labels.chschManageSchemeRuleName}"/>
                                        <h:inputText id="rulename" value="#{chargeRuleFormBean.ruleName}"/>
                                    </div>
                                    <div class="small-5 columns">
                                        <h:outputLabel value="#{labels.chschManageSchemeRuleBegin}"/>

                                        <div class="row">
                                            <div class="small-6 columns">
                                                <div class="row collapse">
                                                    <div class="small-8 columns">
                                                        <h:inputText value="#{chargeRuleFormBean.beginHour}"
                                                                     p:placeholder="0"/>
                                                    </div>
                                                    <div class="small-4 columns">
                                                        <span class="postfix">#{labels.hour}</span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="small-6 columns">
                                                <div class="row collapse">
                                                    <div class="small-8 columns">
                                                        <h:inputText value="#{chargeRuleFormBean.beginMinute}"
                                                                     p:placeholder="0"/>
                                                    </div>
                                                    <div class="small-4 columns">
                                                        <span class="postfix">#{labels.minute}</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="small-5 small-offset-2 columns">
                                        <h:outputLabel value="#{labels.chschManageSchemeRuleEnd}"/>

                                        <div class="row">
                                            <div class="small-6 columns">
                                                <div class="row collapse">
                                                    <div class="small-8 columns">
                                                        <h:inputText value="#{chargeRuleFormBean.endHour}"
                                                                     p:placeholder="0"/>
                                                    </div>
                                                    <div class="small-4 columns">
                                                        <span class="postfix">#{labels.hour}</span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="small-6 columns">
                                                <div class="row collapse">
                                                    <div class="small-8 columns">
                                                        <h:inputText value="#{chargeRuleFormBean.endMinute}"
                                                                     p:placeholder="0"/>
                                                    </div>
                                                    <div class="small-4 columns">
                                                        <span class="postfix">#{labels.minute}</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="small-12 columns">
                                        <h:outputLabel value="#{labels.chschManageSchemeRulePrice}"/>

                                        <div class="row collapse">
                                            <div class="small-2 columns">
                                                <span class="prefix">#{labels.rmb}</span>
                                            </div>
                                            <div class="small-7 columns">
                                                <h:inputText value="#{chargeRuleFormBean.price}" styleClass="text-right"/>
                                            </div>
                                            <div class="small-3 columns">
                                                <span class="postfix">#{labels.pricingUnit}</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <ul class="button-group even-3">
                                    <li>
                                        <h:commandButton value="#{labels.formRemove}" styleClass="button small alert"
                                                         action="#{chargeRuleBean.removeRule}"
                                                         onclick="return confirm('#{labels.chschManageRuleConfirmDelete}')">
                                            <f:ajax execute="admins" render="@form"/>
                                        </h:commandButton>
                                    </li>
                                    <li>
                                        <h:commandButton value="#{labels.formSave}" styleClass="button small"
                                                         action="#{chargeRuleBean.saveRule}">
                                            <f:ajax execute="@form" render="@form"/>
                                        </h:commandButton>
                                    </li>
                                    <li>
                                        <h:commandButton value="#{labels.formReset}" type="reset"
                                                         styleClass="button small secondary"/>
                                    </li>
                                </ul>
                            </fieldset>
                        </div>
                    </div>
                </div>
            </h:form>
        </div>
    </ui:define>
</ui:composition>
</html>
